import '@/style/main.scss';
import ALine from '@/packages/line/index';
import APie from '@/packages/pie/pie';
import ARing from '@/packages/pie/ring';
import ABar from '@/packages/bar/bar';
import AStackBar from '@/packages/bar/stackBar';
import AScatter from '@/packages/scatter/scatter';
import AGuage from '@/packages/gauge/gauge';

const Acharts = {
    ALine: ALine,
    APie: APie,
    ARing: ARing,
    ABar: ABar,
    AStackBar: AStackBar,
    AScatter: AScatter,
    AGuage: AGuage
};

const install = function(Vue, opts = {}) {
    if (install.installed) return;

    Object.keys(Acharts).forEach(key => {
        Vue.component(key, Acharts[key]);
    });

    //TODO  Add global handler
   /*Vue.prototype.$Loading = LoadingBar;
    Vue.prototype.$Message = Message;
    Vue.prototype.$Modal = Modal;
    Vue.prototype.$Notice = Notice;
    Vue.prototype.$Spin = Spin;*/
};

// auto install
if (typeof window !== 'undefined' && window.Vue) {
    install(window.Vue);
}

export default {
    Acharts,
    install,
};
